package com.bw.controller;


import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import com.bw.bean.Vo2;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class VoController {

    @Autowired
    VoService voService;


   @RequestMapping("list1")
    public Map getList1(){
       List<Vo> list = voService.getList1();
       return SugarUtil.getMapData(list);
   }

    @RequestMapping("list2")
    public Map getList2(){
        List<Vo> list = voService.getList2();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("list3")
    public Map getList3(){
        List<Vo> list = voService.getList3();
        return SugarUtil.getPieData(list);
    }



    @RequestMapping("list4")
    public Map getList4(){
        List<Vo1> list = voService.getList4();
        List<String> list1 = new ArrayList<>();
        list1.add("类别");
        list1.add("新用户");
        list1.add("老用户");
        return SugarUtil.getTablePlayData(list1,list);
    }


    @RequestMapping("list5")
    public Map getList5(){
        List<Vo> list = voService.getList5();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("list6")
    public Map getList6(){
        List<Vo> list = voService.getList6();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("list7")
    public Map getList7(){
        List<Vo> list = voService.getList7();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("list8")
    public Map getList8(){
        List<Vo2> list = voService.getList8();
        List<String> list1 = new ArrayList<>();
        list1.add("品牌");
        list1.add("性别");
        list1.add("总金额");
        return SugarUtil.getTablePlayData(list1,list);
    }


    @RequestMapping("list9")
    public Map getList9(){
        Double val = voService.getList9();
        return SugarUtil.getFlipNumberData(val);
    }

    @RequestMapping("list10")
    public Map getList10(){
        List<Vo> list = voService.getList10();
        List<String> list1 = new ArrayList<>();
        list1.add("spu名称");
        list1.add("金额");
        return SugarUtil.getTablePlayData(list1,list);
    }

    //列表(扩展对象 创建表头集合 )  翻牌器 :返回值double

}
